package com.taxsystem.yehao.jsonParser;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import com.taxsystem.yehao.tool.UrlPost;


public class HallWaitListJsonParser {

	public static List<HashMap<String,Object> > parse(String url) {
		List<HashMap<String,Object>>retList = new ArrayList<HashMap<String,Object>>();
		try {
			JSONObject jsonObject = UrlPost.getJsonObject(url, new HashMap<String,Object>());
			 JSONArray jsonArray=jsonObject.getJSONArray("data");
			 for(int i=0;i<jsonArray.length();i++) {
				 JSONObject jsonHallWaitObject = jsonArray.getJSONObject(i);
				 HashMap<String,Object> map = new HashMap<String,Object>();
				 map.put("address", jsonHallWaitObject.getString("address"));
			//	 map.put("avgWaitTime", jsonHallWaitObject.getString("avgWaitTime"));
				 map.put("branchId", jsonHallWaitObject.getString("branchId"));
				 map.put("branchName", jsonHallWaitObject.getString("branchName"));
				 map.put("waitingCount", jsonHallWaitObject.getString("waitingCount"));
				 retList.add(map);
			 }
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			e.getMessage();
		} 
		return retList;
	}
}
